import { formatMessage } from 'umi-plugin-locale'
import { getBaseApi } from '@/utils/request'
getBaseApi();
if (!window.localStorage.MAP) {
    getBaseApi();
}

const { MAP_API_HOST } = window.localStorage;
const api_host = MAP_API_HOST;

export const mapSource = {
    'baidu_online': formatMessage({ 'id': 'common.map.baidu_online' }),
    'baidu_offline': formatMessage({ 'id': 'common.map.baidu_offline' }),
    'esri': formatMessage({ 'id': 'common.map.esri' }),
    'easymap': formatMessage({ 'id': 'common.map.easymap' }),
    'supermap': formatMessage({ 'id': 'common.map.supermap' }),
    'mapbox': formatMessage({ 'id': 'common.map.mapbox' }),
}

export const baiduOnlineScripts = [
    'http://api.map.baidu.com/api?v=3.0&ak=WUqN8xf2jt36o2ZTdIuobaZXRIQUoFVo&callback=a',
    `/js/BMap/library/BMapLib_GeoUtils.js`,
    `/js/BMap/library/DistanceTool.js`,
    `/js/BMap/library/RectangleZoom.js`,
    `/js/BMap/library/DrawingManager.js`,
    `/js/BMap/library/CustomOverlay.js`,
    `/js/BMap/library/RichMarker.js`,
    `/js/BMap/library/TextIconOverlay_min.js`,
    `/js/BMap/library/MarkerClusterer_min.js`,
];

export const baiduOfflineScripts = [
    '/js/BMap/map_load.js',
    `/js/BMap/BMap.js`,
    `/js/BMap/library/BMapLib_GeoUtils.js`,
    `/js/BMap/library/DistanceTool.js`,
    `/js/BMap/library/RectangleZoom.js`,
    `/js/BMap/library/DrawingManager.js`,
    `/js/BMap/library/CustomOverlay.js`,
    `/js/BMap/library/RichMarker.js`,
    `/js/BMap/library/TextIconOverlay_min.js`,
    `/js/BMap/library/MarkerClusterer_min.js`,
];

export const esriScripts = [
    `${api_host}/arcgis_js_api/library/3.12/3.12/dijit/themes/tundra/tundra.css`,
    `${api_host}/arcgis_js_api/library/3.12/3.12/esri/css/esri.css`,
    `${api_host}/arcgis_js_api/library/3.12/3.12/init.js`,
    `${api_host}/arcgis_js_api/library/3.12/3.12/CCFPGISLayer.js`,

    // 'http://js.arcgis.com/3.12/esri/css/esri.css',
    // 'http://js.arcgis.com/3.12/'
];

export const supermapScripts = [
    '/js/supermap/style/leaflet.css',
    '/js/supermap/style/iclient-leaflet.min.css',
    '/js/supermap/style/leaflet.draw.css',
    '/js/supermap/leaflet.js',
    '/js/supermap/iclient-leaflet.js',
]
export const mapboxScripts = [
    // 'https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.js',
    // 'https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.css'
    '/js/mapbox/mapbox-gl.js',
    '/js/mapbox/mapbox-gl.css'
]